/**
 * @author linke
 * @2010-07-21
 * 
 * 基于jquery_1.3.2编写
 */
function ajaxPost(destUrl, data, callback, errCallback) {
	$.ajax({
		type:"POST",
		url:destUrl,
		data:data,
		success:callback,
		error:errCallback
	});
}

function ajaxDelete(url, confirmString) {
	if(confirmString) {
		var b = confirm(confirmString);
		if(!b) {
			return;
		}
	}
	var urlAndParam = url.split('?');
	var destUrl = urlAndParam[0];
	var paramData = urlAndParam[1];
	$.ajax({
		type:"POST",
		url:destUrl,
		data:paramData,
		success:function(json){
			var result = eval('('+ json +')');
			if(result.success) {
				alert('删除成功');
				window.location.reload();
			} else if(result.exception) {
				alert('删除失败，原因：' + result.exception);
			}
		},
		error:function(request, json, errorThrown){
			alert(textStatus);
			alert(errorThrown);
		}
	});
}

function openDialog(url) {
	window.showModalDialog(url, null, 'dialogHeight=300, dialogWidth=360, dialogTop=200, dialogLeft=540, resizable=no, status=yes');
}


function renderTable(table, oddCssName, evenCssName, hoverCssName) {
	$("tr:odd", table).addClass(oddCssName);
	$("tr:even", table).addClass(evenCssName);
	$("tr", table).hover(function(){
		$(this).addClass(hoverCssName);
	},
	function(){
		$(this).removeClass(hoverCssName);
	});
}
